Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
lodash.has
Advanced tools
The lodash.has package is a method from the Lodash library, which is a popular JavaScript utility library. This specific method is used to check if a path exists as a property in a given object, which can be deeply nested. It helps in safely checking for the existence of a property without manually traversing the properties and handling errors.
Check existence of a property
This feature allows you to check whether a specific path exists within an object. It returns true if the path exists, otherwise false. This is useful for avoiding errors when accessing deeply nested properties.
const _ = require('lodash.has');
const object = { 'a': { 'b': { 'c': 3 } } };
console.log(_.has(object, 'a.b.c')); // => true
console.log(_.has(object, 'a.b.c.d')); // => false
object-path is a package that provides a similar functionality to lodash.has, allowing access to nested object properties via a path. It also offers additional methods for setting and deleting properties. Compared to lodash.has, object-path provides a more comprehensive solution for handling object paths.
dot-prop is another npm package that allows you to get, set, or delete properties from a nested object using a dot path. While lodash.has only checks for the existence of a path, dot-prop extends this by allowing modifications to the object, making it more versatile.
The modern build of lodash’s _.has
exported as a Node.js/io.js module.
Using npm:
$ {sudo -H} npm i -g npm
$ npm i --save lodash.has
In Node.js/io.js:
var has = require('lodash.has');
See the documentation or package source for more details.
FAQs
The lodash method `_.has` exported as a module.
The npm package lodash.has receives a total of 798,569 weekly downloads. As such, lodash.has popularity was classified as popular.
We found that lodash.has demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.